

//显示模板图的模态框
var showModelPic = function () {
    if ($(this).attr('four_img') == '')
        return;
    var url ="http://gxj.ngrok.xiaomiqiu.cn/Content/Images/pdf/"+$(this).attr('four_img');
    location.href="../page/PdfView?url="+url;


    // $("#modelPage div.modal-header>p").html("<span style='color:red;'>提示：</span>"+$(this).attr('four_name'));
    // $("#modelPageImgs").html("");
    // $("#modelPageImgs").append("<img alt='' src='../Content/Images/logo/" + $(this).attr('four_img') + "' style='width:100%;'><hr />");
    // $('#modelPage').modal('show');
};



    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return (r[2]); return null;
    }
    var role="";
    var one_id=GetQueryString("one_id");
    var two_id=GetQueryString("two_id");
    var three_id=GetQueryString("three_id");

    var Json={};
    Json["oneId"]=one_id;
    Json["twoId"]=two_id;
    Json["threeId"]=three_id;

    window.onload = function () {

        $.post("../Index/loginJust", null, function (res) {
            var Json = eval(res);
            if(Json[0]["msg"]=="no"){
                alert("登录超时,请重新登录！");
                location.href="../page/login";
            }else{
                role=Json[1]["role"];
                //role="管理员";
                lodingIn();
                if(role=="管理员"){
                    document.getElementById("submit").style.display = "";
                }
            }
        });


    };

        //初始加载提交材料
        function lodingIn ()
        {
            $.post("../Index/checkFourItem", Json, function (res)
            {
                var title=decodeURI(GetQueryString("title"));//decodeURI()将中文转换成字符串
                document.getElementById("titleName").innerHTML = title;
                var testJson = eval(res);
                if (testJson.length >1)
                {
                    if(role=="管理员")
                    {
                        for (var i = 0; i < testJson.length; i++) {
                            $("#List").append(
                                "<button style='float: left' id='ytModel' class='seca' data-modellink='true'  four_img='" + testJson[i]["FOUR_IMG"] + "'  ><img style='width: 58px' src='../Content/Images/lode.jpg'> </img></button>" +
                                // "<a style='float: left'  id='ytModel' class='seca' data-modelLink='true' four_img='" + testJson[i]["FOUR_IMG"] + "'  onclick=' findImg(\" "+testJson[i]["FOUR_IMG"] +" \" )' four_name='"+testJson[i]["FOUR_NAME"]+"'><img  src='../Content/Images/logo/" + testJson[i]["FOUR_IMG"] + "'> </img></a>"+
                                "<label class='weui-cell weui-check__label' for='" + testJson[i]["FOUR_ID"] + "'>" +
                                "<div class='weui-cell__bd'>" +
                                "<p >" + testJson[i]["FOUR_NAME"] + "</p>" +
                                "</div>" +
                                "<div class='weui-cell__hd'>" +
                                "<input type='checkbox' class='weui-check' name='checkbox1' id='" + testJson[i]["FOUR_ID"] + "'  value='" + testJson[i]["FOUR_NAME"] + "' length='"+testJson.length+"'>" +
                                "<i class='weui-icon-checked'></i>" +
                                "</div>" +
                                "</label>"
                            );
                        }
                        $("button[data-modelLink]").on("click", showModelPic);
                    }
                    else {
                        for (var i = 0; i < testJson.length; i++) {
                            $("#List").append(
                                "<button style='float: left'  id='ytModel' class='seca' data-modellink='true'  four_img='"+testJson[i]["FOUR_IMG"]+"'  ><img style='width: 58px' src='../Content/Images/lode.jpg'> </img></button>" +
                                "<label class='weui-cell weui-check__label' for='" + testJson[i]["FOUR_ID"] + "'>" +
                                "<div class='weui-cell__bd'>" +
                                "<p >" + testJson[i]["FOUR_NAME"] + "</p>" +
                                "</label>"
                            );
                        }
                        $("button[data-modelLink]").on("click", showModelPic);
                    }

                }else {
                    alert(testJson[0]["failInfo"]);
                }

            });


        }






















